home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’97 / Warrior’s Progress / source code / Source / Libraries / Fonts / FontSize.cp < prev    next >
Encoding:
Text File  |  1997-06-28  |  959 b   |  62 lines  |  [TEXT/CWIE]

  1. // FontSize.cp
  2.  
  3. #ifndef FontSize_h
  4. #include "FontSize.h"
  5. #endif
  6.  
  7. FontSize FontSize::Make( uint16 value )
  8.   {
  9.     Assert( value >= 0 );
  10.     
  11.     if ( value == 0 )
  12.         return Default();
  13.     
  14.     return value;
  15.   }
  16.  
  17. FontSize FontSize::Default()
  18.   {
  19.     static int16 size = GetDefFontSize();
  20.     return size;
  21.   }
  22.  
  23. void FontSize::operator+=( int16 d )
  24.   {
  25.     int32 result = int32( size ) + int32( d );
  26.     
  27.     Assert( result > 0 );
  28.     Assert( result <= maxint16 );
  29.     
  30.     size = result;
  31.   }
  32.  
  33. void FontSize::operator-=( int16 d )
  34.   {
  35.     int32 result = int32( size ) - int32( d );
  36.     
  37.     Assert( result > 0 );
  38.     Assert( result <= maxint16 );
  39.  
  40.     size  = result;
  41.   }
  42.  
  43. FontSize FontSize::operator+( int16 d ) const
  44.   {
  45.     int32 result = int32( size ) + int32( d );
  46.     
  47.     Assert( result > 0 );
  48.     Assert( result <= maxint16 );
  49.     
  50.     return result;
  51.   }
  52.  
  53. FontSize FontSize::operator-( int16 d ) const
  54.   {
  55.     int32 result = int32( size ) - int32( d );
  56.     
  57.     Assert( result > 0 );
  58.     Assert( result <= maxint16 );
  59.     
  60.     return result;
  61.   }
  62.